/* eslint-disable indent */
/* eslint-disable prefer-const */
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
// import './plugins/element.js'
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/dist/index.css'

import './assets/css/global.css'
// 导入阿里字体图标
import './assets/fonts/iconfont.css'

import * as ElementPlusIconsVue from '@element-plus/icons-vue'

import 'xe-utils'
import VXETable from 'vxe-table'
import 'vxe-table/lib/style.css'

// 富文本编辑器
// import { QuillEditor } from '@vueup/vue-quill'
// import '@vueup/vue-quill/dist/vue-quill.snow.css'

import axios from 'axios'

const app = createApp(App)

//配置公共网址
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
axios.interceptors.request.use(config => {
    //sessionStorage 会话存储
    config.headers.Authorization = window.sessionStorage.getItem('token')
    return config
})
//添加为公共属性
app.config.globalProperties.$http = axios

// 树形组件
app.use(VXETable)

// 富文本
// app.component('QuillEditor', QuillEditor);

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
app.use(router).use(ElementPlus, { locale: zhCn }).mount('#app')
